package week4;

import java.util.Scanner;

public class Score {
	public static void main(String[] args) {
		String []name=new String[10];
		float []score =new float[10];
		scan(name,score);
		find(name,score);
		
		
		}
		public void test(){
			System.out.println("输入学生的名字和java分数，分数为负数是结束输入:");
		}

	
	public static void scan(String[]name,float[]score){
		int i=0;
		float max = 0,min = 0;
		Scanner sc=new Scanner(System.in);
		while (i<10){
			System.out.println("输入学生的名字和java分数，分数为负数是结束输入:");
		    name[i]=sc.next();
		    score[i]=sc.nextFloat();
		    if (score[i]<0){name[i]=null;break;}
		    if(i==0){max=score[i];min=score[i];}
		    if (score[i]>max)max=score[i];
		    if(score[i]<min)min=score[i];
		    i++;
	}
		System.out.println("最低分："+min);
		System.out.println("最高分："+max);

}
	public static void find(String[]name,float[]score){
		int i=0;
		Scanner sc=new Scanner(System.in);
		System.out.println("输入要查找的学生的姓名:");
		String fname =sc.next();
		while (name[i]!=null){
			if(fname.equals(name[i])){
				System.out.print(name[i]+" ");
				System.out.println(score[i]);
				return;
			}
			i++;
		}System.out.println("无法找到该学生");

		
	}
}